#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int n;
	cin >> n;

	while (n--) {
		char ch;
		double h;
		cin >> ch >> h;

		if (ch == 'M') {
			h /= 1.09;
		} else {
			h *= 1.09;
		}

		cout << fixed << setprecision(2) << h << endl;
	}
	return 0;
}
